package com.suineg.pms.entity.base;

import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;


import com.google.common.collect.Lists;
import com.suineg.pms.entity.IdEntity;
import com.suineg.pms.entity.User;

/**
 * 楼栋
 *@author Suine
 */
@Entity
@Table(name = "pms_building")
public class Building extends IdEntity{
	
	/** 楼栋名 */
	private String name;
	/**单元数*/
	private Integer unitCount;
	/** 楼层数 */
	private Integer floorCount;
	/** 竣工时间 */
	private Date jungongDate;
	/** 备注 */
	private String memo;
	/** 操作人 */
	private User opuser;
	/** 操作时间 */
	private Date opdate;
	/** 小区 */
	private Community community;
	/** 楼栋编号  */
	private String no;
	
	/** 房屋集合 */
	private List<Room> roomList = Lists.newArrayList();
	/** 车库集合 */
	private List<Barn> barnList = Lists.newArrayList();
	/** 车位集合 */
	private List<Paking> pakingList = Lists.newArrayList();
	
	@OneToMany(fetch = FetchType.LAZY,mappedBy = "building")
	@OrderBy("id")
	public List<Paking> getPakingList() {
		return pakingList;
	}
	public void setPakingList(List<Paking> pakingList) {
		this.pakingList = pakingList;
	}
	@OneToMany(fetch = FetchType.LAZY,mappedBy = "building")
	@OrderBy("id")
	public List<Barn> getBarnList() {
		return barnList;
	}
	public void setBarnList(List<Barn> barnList) {
		this.barnList = barnList;
	}
	public Building() {
		super();
		// TODO Auto-generated constructor stub
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public Integer getUnitCount() {
		return unitCount;
	}
	public void setUnitCount(Integer unitCount) {
		this.unitCount = unitCount;
	}
	public Integer getFloorCount() {
		return floorCount;
	}
	public void setFloorCount(Integer floorCount) {
		this.floorCount = floorCount;
	}
	public Date getJungongDate() {
		return jungongDate;
	}
	public void setJungongDate(Date jungongDate) {
		this.jungongDate = jungongDate;
	}
	public String getMemo() {
		return memo;
	}
	public void setMemo(String memo) {
		this.memo = memo;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	public User getOpuser() {
		return opuser;
	}
	public void setOpuser(User opuser) {
		this.opuser = opuser;
	}
	public Date getOpdate() {
		return opdate;
	}
	public void setOpdate(Date opdate) {
		this.opdate = opdate;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "community_id")
	public Community getCommunity() {
		return community;
	}
	public void setCommunity(Community community) {
		this.community = community;
	}
	@OneToMany(fetch =FetchType.LAZY,mappedBy = "building")
	public List<Room> getRoomList() {
		return roomList;
	}
	public void setRoomList(List<Room> roomList) {
		this.roomList = roomList;
	}
	public String getNo() {
		return no;
	}
	public void setNo(String no) {
		this.no = no;
	}

}

